home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
038a
/
vegx20.zip
/
VGX.DOC
< prev
next >
Wrap
Text File
|
1990-11-15
|
16KB
|
376 lines
VEGX
VGA and EGA Graphics file formats for
QuickBASIC and Professional BASIC
Programmers
Version 2.0, November, 1990
USER MANUAL
Speed, speed, speed is what we want when loading a graphics file. Second
only to speed is compressed file size. Also desirable is ease of use.
Well, welcome to VEGX! You have received an efficient, fast, and
compressed VGA and EGA graphics file format for your QuickBASIC programs
that is remarkably easy to use.
First, let's get a few preliminaries behind us:
LICENSE AGREEMENT:
All files on the VEGX distribution disk are (C) Copyright, 1990, Dwain
Goforth, Milestone Software, Arcata, California. All rights reserved.
This software package (VEGX20.ZIP and associated files) is for review
purposes only. No license is granted for distribution of this software or
software created using the VEGX object libraries. The single exception to
this is that the original .ZIP distribution package may be distributed
provided no changes are made to any of the enclosed files.
The VEGX package comes with three types of files, 1) compiled object code
in libraries (files with the .LIB extension), 2) executable files
(PCX2VGX.EXE and VGXGRAB.COM), and 3) text and BASIC source code files
(with extensions of .DOC and .BAS)
Upon registration, you will be licensed to distribute executable (.EXE and
.COM) programs of your own creation that use the VEGX object modules. No
royalties or copyright acknowledgement are required. You will also be
licensed to distribute PCX2VGX.EXE and VGXGRAB.EXE as long as they have
not been modified in any way.
You are prohibited from distributing the VEGX object files and their
associated libraries, or any library you make containing the VEGX object
files, unless you are transfering this license in its entirety and
removing all VEGX object files and any libraries containing them from your
computer system.
WARRANTY:
Milestone Software makes no warranties or guarantees concerning use of
this shareware distribution package of VEGX. Registered users will be
guaranteed 100% satisfaction with the version of VEGX which is sent to
them upon registration.
REGISTERING THIS SOFTWARE:
By purchasing registration for this software you will receive 1) a license
to distribute executable programs created with the VEGX object libraries,
2) the most up to date version of the VEGX software, 3) full warranty, and
4) additional files including PALCALLS.BAS, source code of nine pallete
utilities for VGA graphics programmers.
Registration costs $25. Checks or money orders may be sent to Dwain
Goforth, Milestone Software, 1260 Sunset Ave., Arcata, California, 95521.
----------------------------------
FILES ON THE VEGX DISK:
The following files are included on the VEGX distribution disk:
VEGX.DOC - This file, the VEGX manual.
VEGXSPEC.DOC - Specifications of the VEGX format.
VEGX40.LIB - Library for QB 4.0 and BASIC 6.0.
VEGX45.LIB - Library for QB 4.5.
VEGX70N.LIB - Library for BASIC 7.0 using NEAR strings.
VEGX70F.LIB - Library for BASIC 7.0 using FAR strings.
VGEX40.QLB - QB 4.0 and BASIC 6.0 quicklibrary.
VGEX45.QLB - QB 4.5 quicklibrary.
VGEX70F.QLB - BASIC 7.0 (QBX.EXE) quicklibrary (far
strings.)
EGXTEST.BAS - BASIC source code to demonstrate EGX.
VGXTEST.BAS - BASIC source code to demonstrate VGX and
palette calls.
EGXVIEW.BAS - BASIC source code to view EGX files.
VGXVIEW.BAS - BASIC source code to view VGX files.
PCX2EGX.EXE - Program to convert PCX to EGX.
PCX2VGX.EXE - Program to convert PCX to EGX.
EGXGRAB.COM - TSR (memory resident) program to capture
EGA SCREEN 9 (640x350x16) to an EGX file.
VGXGRAB.COM - TSR (memory resident) program to capture
VGA SCREEN 12 (640x480x16) to a VGX file.
-------------------------
INTRODUCTION - What is VEGX?
VEGX are two new graphics file formats for use by QuickBASIC 4.x and BASIC
7.0 programmers. VGX supports ONLY the VGA 640x480 pixel 16-color
graphics mode (SCREEN 12), and because of this it is very fast. EGX is the
same for the EGA 640x350x16 SCREEN 9 mode.
If you've ever programmed EGA or VGA graphics files using the BASIC
BSAVE/BLOAD commands you know that even the least complex image requires
153k of disk space in FOUR separate files (for VGA.) Also, your palette
is not saved. While BLOAD is fast, the file sizes, number of files and
lack of palette are enough to make one think twice before developing a VGA
or EGA image program in BASIC.
HOW DOES VEGX WORK?:
VEGX is similar to BLOAD/BSAVE in that images are stored in "banks" just
like the VGA video memory stores them. Each bank represents one color
(red, blue, green and intensity) and each bit in the bank is either on or
off and represents each pixel. A VGA 640x480 16- color screen uses 152k
of video RAM with each bank using 38k.
VEGX is similar to PCX in that it uses a "run-length" encoding scheme to
compress the data. The PCX format compresses a screen one scan line at a
time (there are 480 scan lines in a VGA 640x480), while VEGX compresses an
entire bank at a time. When a run of the same byte pattern is encountered
in a color bank, VEGX stores a count for them instead of the actual data.
Because banks are a series of 1's and 0's (on and off), the VEGX
compression of an entire bank is usually quite efficient. VEGX switches
banks four times for each file, PCX switches banks four times for each
scan line (1920 times per file!)
The VGA adapter stores the palette in 16 byte-triplets (one byte for each
color; 48 bytes total.) VEGX simply gets this data from the VGA BIOS and
adds it to the VEGX file. Included with the registered VEGX package is a
BASIC program, PALCALLS.BAS which will demonstrate the BIOS palette calls,
show how to "fade" the 48-byte palette data, and also how to rotate the
palette ("palette animation".)
The Save routines work by moving a VGA bank into RAM, compressing the data
into a an array and saving the compressed array as a temporary file. This
is repeated three times, then the temporary files are appended together
along with the palette information. The temporary files are then erased.
In the unlikely event that your computer crashes during a VEGXSave
session, you may find these temporary files on your directory
(filename.VX1 to filename.VX4). They can be erased.
Because VEGXSave copies an image of a bank and allocates an array to hold
the compressed data, VGXSave needs 74k of available RAM to work, while
EGXSave requires 56k of RAM. This RAM is allocated at the beginning of
each VEGXSave call and released at the end of each call.
VEGXLoad works in an opposite manner to VGXSave; a 16k file-load buffer is
created as well as an 38k array to hold an uncompressed bank. The
decompression algorithm works on one buffers worth of data at a time,
filling the bank array. When a bank is full, it is transfered to video
RAM. When a buffer is used up, another is gotten from the disk.
Depending on which option you choose to load a VGX image (fade-in, instant
on, etc...), the palette is processed before or after the actual load.
Because VGXLoad uses a 16k file buffer and a 38k bank array, VGXLoad
requires 54k of free RAM to work. EGXLoad requires 44k of RAM (each bank
is 28k.) This RAM is allocated at the start of each VGXLoad call and
released at the end. The 16k buffer size was chosen as the optimum in a
tradeoff between loading speed and minimizing RAM use. (An earlier,
pre-release version of VGXLoad had a self-allocating buffer of 2k to 64k,
but a "hard- wired" size proved to be faster.)
A number of algorithms were considered for the VGX compression. All of
them pose a tradeoff between compressed file size and speed of loading.
And while greater compression is obtainable, the vast superiority in speed
of the bank-load/run-length compression method left all other options in
the dust.
-----------------------------------------
USING VEGX
The VEGX file format is very easy to use in your QuickBASIC programs. You
simply add VEGXxx.LIB to your normal quicklibrary or use the supplied VEGX
quicklibrary. To create a stand-alone EXE file you link your program's
object file (created with BC) with VEGXxx.LIB.
Once in QB, you simply CALL VGXSave (filname$) to save a file or CALL
VGXLoad (filname$, palflag%) to load a file.
Libraries and Quicklibraries:
It is important to use the correct version of the VEGX library and
quicklibrary for your version of QuickBASIC (or professional
BASIC.) If you have QB 4.0 or BASIC 6.0 please use VEGX40.LIB and
VEGX40.QLB; if you have QB 4.5 please use VEGX45.LIB and VEGX45.QLB;
and if you have BASIC 7.0 please use VEGX70.QLB in the QBX
environment (far string quicklibrary) and VEGX70N.LIB to compile as
near strings or VEGX70F.LIB to compile using far strings.
To load QB using the VEGX quicklibrary type "QB /L quicklibraryname"
at the DOS prompt.
I have assumed that you already have your own personal library and
quicklibrary to which you will want to add VEGXxx.LIB. To do so,
type the following at the DOS prompt:
LIB yourname.lib +VEGXxx.LIB;
LINK /q yourname.lib
At the "Library" prompt type "BQLB40" if you have QB 4.0,
"BQLB41" if you have BASIC 6.0, "BQLB45" if you have QB 4.5
or "QBXQLB" if you have BASIC 7.0. (If you have BASIC 7.0
remember that you cannot make a near-string quicklibrary using
VEGX70N.LIB, you have use far strings in the QBX environment.)
USING VGXSave and EGXSave:
Once in QB with a quicklibrary loaded containing VGX you may call VGXSave
and VGXLoad. Prior to either call you MUST have entered VGA 640x480
16-color graphics mode (SCREEN 12). The syntax to call VGXSave is as
follows:
CALL VGXSave(filnam$)
IMPORTANT!!! --> Please note that "filnam$" DOES NOT include the
extension, thus to make a VGX file named "TEST.VGX" you CALL
VGXSave("test"), the extension will be added by VGXSave itself.
Or...
fil$="test"
CALL VGXSave(fil$)
You may also pass a path...
fil$="C:\graphics\vgx\test"
CALL VGXSave(fil$)
To be on the safe side, your disk should have 153k of free space
for the maximum size of any potential VEGX file.
Using EGXSave is identical to VGXSave, except of course you must be in EGA
640x350 16-color mode (SCREEN 9) and the file created will automatically
be given the EGX extension.
USING VGXLoad and EGXLoad:
The VGXLoad routine has two parameters and is called as follows:
CALL VGXLoad(Fil$, Flag%)
Again, DO NOT use a filename extension for Fil$.
Flag% is the parameter to choose one of five loading options, from
"instant on" to "fade-in".
Flag% may range from 0 to 4. The following table shows the action
for the Flag% options:
action for action for
current screen being
Flag% screen loaded
----------------------------------------------
0 no blank bank load
1 blank to color 0 instant on
2 blank to color 0 fade in
3 fade out instant on
4 fade out fade in
If Flag is 0 then the current image gets replaced one bank at a
time, as soon as they are ready. This is the fastest method to
load a VEGX screen. It is very much like BLOADing.
If Flag is 1 or 2 then the current image is cleared to its current
background color (whatever color is assigned to attribute 0).
If Flag is 3 or 4 then the palette for the current image is faded
by changing each attribute closer to attribute 0 (color 0) in a 64
count loop.
For the VEGX screen you are loading "instant on" is where the file
is loaded into video RAM while all the colors are set to attribute
zero and then DOS is called to set the actual palette that was
stored in the file. This method of setting the palette is very
fast, much faster than using BASIC's PALETTE statements. See
PALCALLS.BAS for the syntax used in VGXLoad.
"Fade in" makes a 64 count loop, gradually changing the colors from
attribute zero to their correct value.
Using EGXLoad is similar EXCEPT you only have two PalFlag% options, 0 or
1. When PalFlag% = 0 then the image will come on the screen one bank at a
time. When PalFlag% = 1 then the screen will be cleared (all colors set
to zero, black) while the EGX file is loaded, then the pallete will be set
all at once after all the screen data is there.
RUNNING PCX2VGX.EXE and PCX2EGX.EXE:
If you have PCX files in 640x480 16-color format you can convert them to
VGX format using PCX2VGX. PCX2VGX will convert the file, test load it,
and even test the gray-scale color balance (to see how your image will
look on a monochrome VGA display.)
Please note that ONLY 640x480 16-color PCX files will convert correctly
with PCX2VGX and ONLY 640x350 16-color PCX files will convert with PCX2EGX.
Type `PCX2VGX filename' or 'PCX2EGX filename' at the DOS prompt, DO NOT
include any filename extension in `filename'.
RUNNING VGXGRAB.COM and EGXGRAB.COM:
VGXGRAB and EGXGRAB are TSR (memory resident) programs that will dump
whatever is on your VGA 640x480 16-color (or EGA 640x350x16) screen to a
VGX or EGX file, respectively. Type VGXGRAB or EGXGRAB at the DOS prompt
and it will become resident. VGXGRAB will allocate approximately 80k of
RAM while resident (64k for EGXGRAB). Some paint programs that require a
full 640k to run will not run when VGXGRAB is resident (you will get an
"insufficient memory" error) In that event, hopefully, your paint program
will save to a PCX file format which you can then convert to VGX using
PCX2VGX.
After VGXGRAB or EGXGRAB is resident, run whatever screen display program
you wish to capture from (VGXVIEW and VGXDEMO will work) and hit the
"hotkey" to save the image to a VGX format file. The hotkey is CTRL/ENTER
(both the "Control" and "Enter" keys pressed at the same time.) After the
VGX or EGX file is saved you will hear a short beep and control will
return to your display program.
VGX files saved by VGXGRAB are named VGXxxx.VGX where xxx is a number, so
the first VGX file you create with VGXGRAB will be VGX1.VGX, the second,
VGX2.VGX, and so on. If a VGX file with the same name already exists,
that number will be skipped, so, for example, if VGX1.VGX and VGX2.VGX
already exist on the default directory, then the fist file VGXGRAB will
save is VGX3.VGX, etc...
EGXGRAB works the same way, only files are named EGXxxx.EGX where xxx is a
number.
VGXGRAB and EGXGRAB cannot be removed from memory. In other words you
must reboot your computer to remove them. I have attempted to create
removable TSR's (and will continue to try) but so far they are quite buggy
and I would rather be safe than sorry.
Please remember that VGXGRAB and EGXGRAB are designed specifically for the
640x480x16 and 640x350x16 graphics modes. Using them with other modes
will give unpredictable results.
- - - - - - -
In summary, remember you have three ways to create a VEGX file, 1) in QB
(or your compiled EXE) using VGXSave, 2) converting PCX files using
PCX2VGX, and 3) running the TSR program, VGXGRAB and capturing screens
while in another program.
--------------------------------
Thank you for trying VEGX. Please feel free to call or write with any
questions or comments.
Dwain Goforth
Milestone Software
1260 Sunset Ave.
Arcata, CA 95521 USA
(707) 822-1291